﻿using System.Windows;

namespace JulMar.Silverlight.Extensions
{
    /// <summary>
    /// Properties used to control the design surface details
    /// </summary>
    public static class Designer
    {
        private static bool? _inDesignMode;

        /// <summary>
        /// Returns true/false whether the code is currently being executed by a designer surface
        /// (Blend or Visual Studio).
        /// </summary>
        public static bool InDesignMode
        {
            get
            {
                if (_inDesignMode == null)
                    _inDesignMode = Application.Current == null || Application.Current.GetType() == typeof(Application);
                return _inDesignMode.Value;
            }
        }
    }
}


